<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- Tell the browser to be responsive to screen width -->
<meta
	content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
	name="viewport">

<#include "../common/header.html">

</head>
<body class="hold-transition skin-purple-light sidebar-mini">
	<div class="wrapper">
		<!-- 	顶部和左侧菜单的jsp s -->
		<#include "../common/menu.html">
		<!-- 	顶部和左侧菜单的jsp e -->

		<!-- Content Wrapper. Contains page content -->
		<div class="content-wrapper">
			<!-- Content Header (Page header) -->
			<!-- 			<section class="content-header">
				<h1>Data Tables</h1>
			</section> -->

			<section class="content-header condition clearfix ">
				<form action="#" id="fromCondition">
					<div class="form-group">
						<label>用户Id acct-trans-list:</label> <input type="text"
							class="form-control" name="search_EQ_LONG_acctId">
					</div>
					<div class="form-group">
						<label>关联渠道的单号:</label> <input type="text" class="form-control"
							name="search_EQ_STRING_relatedOrderId">
					</div>

					<div class="form-group">
						<label>加/减值:</label> <select class="form-control select2"
							style="width: 100%;" name="search_EQ_INTEGER_flag">
							<option selected="selected" value="">全部</option> <#list
							flagMap?keys as key>
							<option value="${key}">${flagMap[key]!}</option> </#list>
						</select>
					</div>

					<div class="form-group">
						<label>交易类型:</label> <select class="form-control select2"
							style="width: 100%;" name="search_EQ_INTEGER_tradeType">
							<option selected="selected" value="">全部</option> <#list
							tradeTypeMap?keys as key>
							<option value="${key}">${tradeTypeMap[key]!}</option> </#list>
						</select>
					</div>


					<!-- Date range -->
					<div class="form-group">
						<label>交易时间:</label>
						<div class="input-group">
							<div class="input-group-addon">
								<i class="fa fa-calendar"></i>
							</div>
							<input type="text" class="form-control pull-right daterange"
								name="search_DATERANGE_DATE_tradeTime" />
						</div>
						<!-- /.input group -->
					</div>
					<!-- /.form group -->
					<div class="form-group">
						<input type="button" value="查询" id="submit" @click="submitForm" />&nbsp&nbsp
						<input type="reset" value="清空" id="reset" />
					</div>
				</form>
			</section>

			<!-- Main content -->
			<section class="content">
				<div class="row">
					<div class="col-xs-12">
						<div class="box">
							<!-- /.box-header -->
							<div class="box-body">
								<table id="dataTable" class="table table-bordered table-striped" style="min-width: 1623px">
									<thead>
										<tr>
										    <th>选择</th>
											<th>记录Id</th>
											<th>用户Id</th>
											<th>加值/减值</th>
											<th>交易类型</th>
											<th>交易金额(元)</th>
											<th>交易时间</th>
											<th>关联渠道的单号</th>
											<th>交易前余额(元)</th>
											<th>交易后余额(元)</th>
											
										</tr>
									</thead>
								</table>
							</div>
							<!-- /.box-body -->
						</div>
						<!-- /.box -->
					</div>
					<!-- /.col -->
				</div>
				<!-- /.row -->
			</section>
			<!-- /.content -->
		</div>

	</div>
	<!-- ./wrapper -->
</body>
<script>
  //存放选中行的id的数组
  var selected = [];
  
  //adminlte表格的对象
  var datatable = null;
  var formValidator = null;
  
  $(function () {
		    
	   var vm = new Vue({
	 		 el: '#fromCondition',
		    methods: {
		    	submitForm: function () {
				  	datatable.draw();
				  	//每次重画后,清空选中的记录
		    		selected.splice(0,selected.length)
		    	}
      	  }
  	  })
       
      datatable = $('#dataTable').DataTable({
           'paging'      : true,
           'lengthChange': true,
           'searching'   : false,
           'ordering'    : true,
           'info'        : true,
           'autoWidth'   : true,
           "scrollX"	 : true,
           "scrollY"	 : true ,  
           "processing"	 : true,
           "serverSide"	 : true,
           "pagingType": "full_numbers",
           "language": {
               "lengthMenu":   "显示 _MENU_ 条记录",
               "zeroRecords":  "没有符合条件的记录",
               "info":         "第 _PAGE_ 页,共 _PAGES_ 页",
               "infoEmpty":    "没有符合条件的记录",
               "paginate": {
            	   "first":     "第一页",
            	   "next":      "下一页",
            	   "previous":  "上一页",
            	   "last":      "最后一页"
                }           	  
           },
           "preDrawCallback": function( settings ) {
        	   if(!isEmpty(formValidator)) {
        		   if(!formValidator.valid()) {
            		   return false;
            	   }
        	   }  
        	},
           "drawCallback": function( settings ) {
        	   //每次重画后,清空选中的记录
	    		selected.splice(0,selected.length);
           },
           "ajax": {
               "url": "/cloudpay/merchant/acctTrans/listData",
               "type": "POST",
               "data": function ( d ) {
            	  var formData = $("#fromCondition").serializeJson();
            	  for(var obj in formData)  {
            		  d[obj+""] = formData[obj];
            	  }
              }
           },
           "columns": [
			   { "data": "checkBoxId", "orderable": false,"render":function(data, type, full, meta) {
 	   				return  '<input type="checkbox" value="' + data + '">';
               }},
			   { "data": "id" },
               { "data": "acctId" },
               { "data": "flag",
            	   "render": function ( data, type, full, meta ) {     
	            	   <#list flagMap?keys as key>
	         	   	  if(data == '${key}') {
	         	   		  return '${flagMap[key]!}';
	         	   	  }
	    	  		  </#list>
	        		}
               },
               { "data": "tradeType" ,
	            	 "render": function ( data, type, full, meta ) {     
	            	   <#list tradeTypeMap?keys as key>
	            	   	  if(data == '${key}') {
	            	   		  return '${tradeTypeMap[key]!}';
	            	   	  }
	       	  		  </#list>
               		}
               },
               { "data": "tradeFee",
 	            	"render": function ( data, type, full, meta ) {     
 	            		if (parseInt(data).toString() == "NaN") {
 	            		　　return "";
 	            		} else {
 	            		　　return data/100.0;
 	            		}
 	            		
	               	} 
               },
               { "data": "tradeTime"},
               { "data": "relatedOrderId" },
               { "data": "balanceBefore",
	            	"render": function ( data, type, full, meta ) {     
 	            		if (parseInt(data).toString() == "NaN") {
 	 	            		return "";
 	 	            	} else {
 	 	            		return data/100.0;
 	 	            	}
	               	} 
               },
               { "data": "balanceAfter",
	            	"render": function ( data, type, full, meta ) {     
 	            		if (parseInt(data).toString() == "NaN") {
 	 	            		return "";
 	 	            	} else {
 	 	            		return data/100.0;
 	 	            	}
	            }}
			]
           
         })
         
        
   
} );
         
  
 
 
</script>
<script src="${resurcePath}/cloudpay/js/common/dataTable.js"></script>
</html>